/**
 *
 * 特种设备所有设备参数
 *
 * */

// 塔吊设备参数
export const crane_params_data = [
    {
        name: '幅度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'range',
        params_type: 1,
    },
    {
        name: '高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'height',
        params_type: 1,
    },
    {
        name: '吊重',
        value: 0,
        unit: 't',
        flag: false,
        type: 1,
        key: 'weight',
        params_type: 1,
    },
    {
        name: '风速',
        value: 0,
        unit: 'm/s',
        flag: false,
        type: 1,
        key: 'windSpeed',
        params_type: 1,
    },
    {
        name: '力矩比',
        value: 0,
        unit: '%',
        flag: false,
        type: 1,
        key: 'momentRatio',
        params_type: 1,
    },
    {
        name: '倾角',
        value: 0,
        unit: '°',
        flag: false,
        type: 1,
        key: 'dipAngle',
        params_type: 1,
    },
    {
        name: '转角',
        value: 0,
        unit: '°',
        flag: false,
        type: 1,
        key: 'turnAngle',
        params_type: 1,
    },
];

// 升降机设备参数
export const lift_params_data = [
    {
        name: '高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'height',
        params_type: 1,
    },
    {
        name: '速度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'speed',
        params_type: 1,
    },
    {
        name: '风速',
        value: 0,
        unit: 'm/s',
        flag: false,
        type: 1,
        key: 'windSpeed',
        params_type: 1,
    },
    {
        name: '人数',
        value: 0,
        unit: '人',
        flag: false,
        type: 1,
        key: 'personNo',
        params_type: 1,
    },
    {
        name: '载重',
        value: 0,
        unit: 't',
        flag: false,
        type: 1,
        key: 'weight',
        params_type: 1,
    },
    {
        name: '倾角',
        value: 0,
        unit: '°',
        flag: false,
        type: 1,
        key: 'dipAngle',
        params_type: 1,
    },
    {
        name: '高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'height',
        params_type: 1,
    },
    {
        name: '速度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'speed',
        params_type: 1,
    },
    {
        name: '风速',
        value: 0,
        unit: 'm/s',
        flag: false,
        type: 2,
        key: 'windSpeed',
        params_type: 1,
    },
    {
        name: '人数',
        value: 0,
        unit: '人',
        flag: false,
        type: 2,
        key: 'personNo',
        params_type: 1,
    },
    {
        name: '载重',
        value: 0,
        unit: 't',
        flag: false,
        type: 2,
        key: 'weight',
        params_type: 1,
    },
    {
        name: '倾角',
        value: 0,
        unit: '°',
        flag: false,
        type: 2,
        key: 'dipAngle',
        params_type: 1,
    },
];

//龙门吊设备参数
export const gantry_params_data = [
    {
        name: '刚腿位移',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'rigidLegShift',
        params_type: 1,
    },
    {
        name: '柔腿位移',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'softLegShift',
        params_type: 1,
    },
    {
        name: '运行偏斜',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'runningTurn',
        params_type: 1,
    },
    {
        name: '位移',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'shift',
        params_type: 1,
    },
    {
        name: '主钩起升高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'mainHookLiftHeight',
        params_type: 1,
    },
    {
        name: '副钩起升高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'subHookLiftHeight',
        params_type: 1,
    },
    {
        name: '主钩起升重量',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'mainHookLiftWeight',
        params_type: 1,
    },
    {
        name: '副钩起升重量',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'subHookLiftWeight',
        params_type: 1,
    },
    {
        name: '风速',
        value: 0,
        unit: 'm',
        flag: false,
        type: 3,
        key: 'windSpeed',
        params_type: 1,
    },
];

//架桥机设备参数
export const bridge_params_data = [
    {
        name: '起升高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'frontLiftHeight',
        params_type: 1,
    },
    {
        name: '纵移位置',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'frontLngPosition',
        params_type: 1,
    },
    {
        name: '横移位置',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'frontLatPosition',
        params_type: 1,
    },
    {
        name: '起升重量',
        value: 0,
        unit: 't',
        flag: false,
        type: 1,
        key: 'frontLiftWeight',
        params_type: 1,
    },
    {
        name: '起升高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'backLiftHeight',
        params_type: 1,
    },
    {
        name: '纵移位置',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'backLngPosition',
        params_type: 1,
    },
    {
        name: '横移位置',
        value: 0,
        unit: 'm',
        flag: false,
        type: 2,
        key: 'backLatPosition',
        params_type: 1,
    },
    {
        name: '起升重量',
        value: 0,
        unit: 't',
        flag: false,
        type: 2,
        key: 'backLiftWeight',
        params_type: 1,
    },
    {
        name: '纵移位置',
        value: 0,
        unit: 'm',
        flag: false,
        type: 3,
        key: 'lngPosition',
        params_type: 1,
    },
    {
        name: '横移位置',
        value: 0,
        unit: 'm',
        flag: false,
        type: 3,
        key: 'latPosition',
        params_type: 1,
    },
    {
        name: '风速',
        value: 0,
        unit: 'm/s',
        flag: false,
        type: 4,
        key: 'windSpeed',
        params_type: 1,
    },
    {
        name: '主梁水平度',
        value: 0,
        unit: '°',
        flag: false,
        type: 4,
        key: 'levelAngle',
        params_type: 1,
    },
    {
        name: '前支垂直度',
        value: 0,
        unit: '°',
        flag: false,
        type: 4,
        key: 'verticalAngle',
        params_type: 1,
    },
];

//履带吊设备参数
export const crawler_params_data = [
    {
        name: '工况设置',
        value: 0,
        unit: '',
        flag: false,
        type: 1,
        key: 'conditions',
        params_type: 1,
    },
    {
        name: '主钩吊重',
        value: 0,
        unit: 't',
        flag: false,
        type: 1,
        key: 'mainHookWeight',
        params_type: 1,
    },
    {
        name: '主钩高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'mainHookHeight',
        params_type: 1,
    },
    {
        name: '副钩吊重',
        value: 0,
        unit: 't',
        flag: false,
        type: 1,
        key: 'viceHookWeight',
        params_type: 1,
    },
    {
        name: '副钩高度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'viceHookHeight',
        params_type: 1,
    },
    {
        name: '风速',
        value: 0,
        unit: 'm/s',
        flag: false,
        type: 1,
        key: 'windSpeed',
        params_type: 1,
    },
    {
        name: '水平度',
        value: 0,
        unit: '°',
        flag: false,
        type: 1,
        key: 'levelness',
        params_type: 1,
    },
    {
        name: '回转角度',
        value: 0,
        unit: '°',
        flag: false,
        type: 1,
        key: 'turnAngle',
        params_type: 1,
    },
    {
        name: '回转速度',
        value: 0,
        unit: '°/s',
        flag: false,
        type: 1,
        key: 'turnSpeed',
        params_type: 1,
    },
    {
        name: '幅度',
        value: 0,
        unit: 'm',
        flag: false,
        type: 1,
        key: 'range',
        params_type: 1,
    },
    {
        name: '俯仰角',
        value: 0,
        unit: '°',
        flag: false,
        type: 1,
        key: 'dipAngle',
        params_type: 1,
    },
    {
        name: '主钩力矩',
        value: 0,
        unit: '吨米',
        flag: false,
        type: 1,
        key: 'mainHookMoment',
        params_type: 1,
    },
    {
        name: '副钩力矩',
        value: 0,
        unit: '吨米',
        flag: false,
        type: 1,
        key: 'viceHookMoment',
        params_type: 1,
    },
    {
        name: '回转报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'turnWarn',
        params_type: 2,
    },
    {
        name: '主钩高度报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'mainHookWeightWarn',
        params_type: 2,
    },
    {
        name: '主钩重量报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'mainHookHeightWarn',
        params_type: 2,
    },
    {
        name: '副钩高度报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'viceHookHeightWarn',
        params_type: 2,
    },
    {
        name: '副钩重量报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'viceHookWeightWarn',
        params_type: 2,
    },
    {
        name: '防后倾报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'dipAngleWarn',
        params_type: 2,
    },
    {
        name: '风速报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'windSpeedWarn',
        params_type: 2,
    },
    {
        name: '不正常操作报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'abnormalOpWarn',
        params_type: 2,
    },
    {
        name: '防撞探头报警',
        value: 0,
        unit: '',
        flag: false,
        type: 2,
        key: 'probeDistanceWarn',
        params_type: 2,
    },
    {
        name: '回转左转',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'turnLeft',
        params_type: 3,
    },
    {
        name: '回转右转',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'turnRight',
        params_type: 3,
    },
    {
        name: '主钩上升',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'mainHookUp',
        params_type: 3,
    },
    {
        name: '主钩下降',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'mainHookDown',
        params_type: 3,
    },
    {
        name: '副钩上升',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'viceHookUp',
        params_type: 3,
    },
    {
        name: '副钩下降',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'viceHookDown',
        params_type: 3,
    },
    {
        name: '主钩抱闸状态',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'mainHookBrake',
        params_type: 3,
    },
    {
        name: '副钩抱闸状态',
        value: 0,
        unit: '',
        flag: false,
        type: 3,
        key: 'viceHookBrake',
        params_type: 3,
    },
    {
        name: '防后倾限位',
        value: 0,
        unit: '',
        flag: false,
        type: 4,
        key: 'dipAngleLimit',
        params_type: 3,
    },
    {
        name: '门限位',
        value: 0,
        unit: '',
        flag: false,
        type: 4,
        key: 'doorLimit',
        params_type: 3,
    },
    {
        name: '主钩高度上限位',
        value: 0,
        unit: '',
        flag: false,
        type: 4,
        key: 'mainHookHeightUpperLimit',
        params_type: 3,
    },
    {
        name: '主钩高度下限位',
        value: 0,
        unit: '',
        flag: false,
        type: 4,
        key: 'mainHookHeightLowerLimit',
        params_type: 3,
    },
    {
        name: '副钩高度上限位',
        value: 0,
        unit: '',
        flag: false,
        type: 4,
        key: 'viceHookHeightUpperLimit',
        params_type: 3,
    },
    {
        name: '副钩高度下限位',
        value: 0,
        unit: '',
        flag: false,
        type: 4,
        key: 'viceHookHeightLowerLimit',
        params_type: 3,
    },
];


export function initParamsData(arr, obj) {
    // 强行深拷贝
    let results = JSON.parse(JSON.stringify(arr));
    for (let i = 0; i < results.length; i++) {
        let item = results[i];
        if (item.key in obj) {
            if(item.params_type === 2){
                item['value_text'] = obj[item.key] === 0 ? '正常' : '报警';
            }else if(item.params_type === 3){
                item['value_text'] = obj[item.key] === 1 ? '开' : '关';
            }
            item.value = obj[item.key];
            // item.flag = true;
        }
    }
    return results;
};
